
package modelpack;

import controlpack.TokoService;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class Koneksi {
    private static Connection connection;
    private static TokoService tokoService;

    public static Connection getConnection() {
        return connection;
    }

    public static void inisialiasi() throws ClassNotFoundException, SQLException {
	String dbDriver = "com.mysql.jdbc.Driver";
	String url = "jdbc:mysql://localhost:3306/produk";
	String user = "root";
	String pass = "admin";

	Class.forName(dbDriver);
	connection = DriverManager.getConnection(url, user, pass);
	tokoService = new TokoService(connection);
    }

    public static void disconnect() throws SQLException {
	connection.close();
    }


}
